// This example shows how to subscribe to event notifications, pull events, and display each incoming event. using System; using OpcLabs.EasyOpc.UA; using OpcLabs.EasyOpc.UA.AddressSpace.Standard; using OpcLabs.EasyOpc.UA.OperationModel; namespace UADocExamples.AlarmsAndConditions { class PullEventNotification { public static void Main1() { // Define which server we will work with. UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer"; // Instantiate the client object. // In order to use event pull, you must set a non-zero queue capacity upfront. var client = new EasyUAClient { PullEventNotificationQueueCapacity = 1000 }; Console.WriteLine("Subscribing..."); client.SubscribeEvent(endpointDescriptor, UAObjectIds.Server, 1000); Console.WriteLine("Processing event notifications for 30 seconds..."); int endTick = Environment.TickCount + 30 * 1000; do { EasyUAEventNotificationEventArgs eventArgs = client.PullEventNotification(2 * 1000); if (!(eventArgs is null)) // Handle the notification event. Console.WriteLine(eventArgs); } while (Environment.TickCount < endTick); Console.WriteLine("Unsubscribing..."); client.UnsubscribeAllMonitoredItems(); Console.WriteLine("Finished."); } // Example output (truncated): //Subscribing... //Processing event notifications for 30 seconds... //[] Success //[] Success; Refresh; RefreshInitiated //[] Success; Refresh; (10 field results) [EastTank] 100! "The dialog was activated" @9/10/2019 8:08:23 PM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:13 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm was acknoweledged." @11/9/2019 9:56:23 AM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:17 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:09:07 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:10:09 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:02 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:16 PM //[] Success; Refresh; (10 field results) [NorthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:11 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:10:19 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:12 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:04 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:08:58 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:09:48 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [SouthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [SouthMotor] 700! "The alarm was acknoweledged." @10/14/2019 4:00:21 PM //[] Success; Refresh; (10 field results) [SouthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:03 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:02 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:59 PM //[] Success; Refresh; RefreshComplete //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [NorthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [WestTank] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [SouthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:55 AM //... } }
# This example shows how to subscribe to event notifications, pull events, and display each incoming event. #requires -Version 5.1 using namespace OpcLabs.EasyOpc.UA using namespace OpcLabs.EasyOpc.UA.AddressSpace using namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard # The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows . Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUA.dll" Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUAComponents.dll" # Define which server we will work with. [UAEndpointDescriptor]$endpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer" # Instantiate the client object. $client = New-Object EasyUAClient # In order to use event pull, you must set a non-zero queue capacity upfront. $client.PullEventNotificationQueueCapacity = 1000 Write-Host "Subscribing..." [IEasyUAClientExtension]::SubscribeEvent($client, $endpointDescriptor, [UAObjectIds]::Server, 1000) Write-Host "Processing event notifications for 30 seconds..." $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() while ($stopwatch.Elapsed.TotalSeconds -lt 60) { $eventArgs = $client.PullEventNotification(2*1000) if ($eventArgs -ne $null) { # Handle the notification event. Write-Host $eventArgs } } Write-Host "Unsubscribing..." $client.UnsubscribeAllMonitoredItems() Write-Host "Finished." # Example output (truncated): #Subscribing... #Processing event notifications for 30 seconds... #[] Success #[] Success; Refresh; RefreshInitiated #[] Success; Refresh; (10 field results) [EastTank] 100! "The dialog was activated" @9/10/2019 8:08:23 PM #[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:13 PM #[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm was acknoweledged." @11/9/2019 9:56:23 AM #[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:17 PM #[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:09:07 PM #[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:10:09 PM #[] Success; Refresh; (10 field results) [NorthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM #[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:02 PM #[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:16 PM #[] Success; Refresh; (10 field results) [NorthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM #[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:11 PM #[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:10:19 PM #[] Success; Refresh; (10 field results) [WestTank] 100! "The dialog was activated" @9/10/2019 8:08:25 PM #[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:12 PM #[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM #[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:04 PM #[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:08:58 PM #[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:09:48 PM #[] Success; Refresh; (10 field results) [SouthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM #[] Success; Refresh; (10 field results) [SouthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM #[] Success; Refresh; (10 field results) [SouthMotor] 700! "The alarm was acknoweledged." @10/14/2019 4:00:21 PM #[] Success; Refresh; (10 field results) [SouthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:03 PM #[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:02 PM #[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:59 PM #[] Success; Refresh; RefreshComplete #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:43 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:43 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:44 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:44 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:45 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:45 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:46 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:46 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:47 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:47 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:48 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:48 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:49 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:49 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:50 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:50 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:51 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:51 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:52 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:52 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:53 AM #[] Success; (10 field results) [NorthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:53 AM #[] Success; (10 field results) [WestTank] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM #[] Success; (10 field results) [SouthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:54 AM #[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:54 AM #[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:55 AM #...
# This example shows how to subscribe to event notifications, pull events, and display each incoming event. # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc import time # Import .NET namespaces. from OpcLabs.EasyOpc.UA import * from OpcLabs.EasyOpc.UA.AddressSpace.Standard import * from OpcLabs.EasyOpc.UA.OperationModel import * # Define which server we will work with. endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer') # Instantiate the client object. # In order to use event pull, you must set a non-zero queue capacity upfront. client = EasyUAClient() client.PullEventNotificationQueueCapacity = 1000 print('Subscribing...') IEasyUAClientExtension.SubscribeEvent( client, endpointDescriptor, UANodeDescriptor(UAObjectIds.Server), 1000) print('Processing event notifications for 30 seconds...') endTime = time.time() + 30 while time.time() < endTime: eventArgs = IEasyUAClientExtension.PullEventNotification(client, 2*1000) if eventArgs is not None: # Handle the notification event. print(eventArgs) print('Unsubscribing...') client.UnsubscribeAllMonitoredItems() print('Finished.')
' This example shows how to subscribe to event notifications, pull events, and display each incoming event. Imports OpcLabs.EasyOpc.UA Imports OpcLabs.EasyOpc.UA.AddressSpace.Standard Imports OpcLabs.EasyOpc.UA.OperationModel Namespace AlarmsAndConditions Friend Class PullEventNotification Public Shared Sub Main1() ' Instantiate the client object Dim client = New EasyUAClient() ' In order to use event pull, you must set a non-zero queue capacity upfront. client.PullEventNotificationQueueCapacity = 1000 Console.WriteLine("Subscribing...") client.SubscribeEvent( "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer", UAObjectIds.Server, 1000) Console.WriteLine("Processing event notifications for 30 seconds...") Dim endTick As Integer = Environment.TickCount + 30 * 1000 Do Dim eventArgs As EasyUAEventNotificationEventArgs = client.PullEventNotification(2 * 1000) If Not eventArgs Is Nothing Then ' Handle the notification event Console.WriteLine(eventArgs) End If Loop While Environment.TickCount < endTick End Sub End Class End Namespace
// This example shows how to subscribe to event notifications, pull events, and display each incoming event. class procedure PullEventNotification.Main; var Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient; EndTick: Cardinal; EventArgs: _EasyUAEventNotificationEventArgs; begin // Instantiate the client object and hook events Client := CoEasyUAClient.Create; // In order to use event pull, you must set a non-zero queue capacity upfront. Client.PullEventNotificationQueueCapacity := 1000; WriteLn('Subscribing...'); Client.SubscribeEvent( 'opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer', 'nsu=http://opcfoundation.org/UA/;i=2253', // UAObjectIds.Server 1000); WriteLn('Processing event notifications for 30 seconds...'); EndTick := Ticks + 30*1000; while Ticks < EndTick do begin EventArgs := Client.PullEventNotification(2*1000); if EventArgs <> nil then // Handle the notification event WriteLn(EventArgs.ToString); end; WriteLn('Unsubscribing...'); Client.UnsubscribeAllMonitoredItems; WriteLn('Finished.'); end; // Example output (truncated): //Subscribing... //Processing event notifications for 30 seconds... //[] Success //[] Success; Refresh; RefreshInitiated //[] Success; Refresh; (10 field results) [EastTank] 100! "The dialog was activated" @9/10/2019 8:08:23 PM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:13 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm was acknoweledged." @11/9/2019 9:56:23 AM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:17 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:09:07 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:10:09 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:02 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:16 PM //[] Success; Refresh; (10 field results) [NorthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:11 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:10:19 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:12 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:04 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:08:58 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:09:48 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [SouthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [SouthMotor] 700! "The alarm was acknoweledged." @10/14/2019 4:00:21 PM //[] Success; Refresh; (10 field results) [SouthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:03 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:02 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:59 PM //[] Success; Refresh; RefreshComplete //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [NorthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [WestTank] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [SouthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:55 AM //...
// This example shows how to subscribe to event notifications, pull events, and display each incoming event. // Instantiate the client object and hook events $Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient"); $Client->PullEventNotificationQueueCapacity = 1000; printf("Subscribing...\n"); $Client->SubscribeEvent( "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer", "nsu=http://opcfoundation.org/UA/;i=2253", // UAObjectIds_Server 1000); printf("Processing event notifications for 30 seconds...\n"); $startTime = time(); do { $EventArgs = $Client->PullEventNotification(2*1000); if (!is_null($EventArgs)) { // Handle the notification event printf("%s\n", $EventArgs); } } while (time() < $startTime + 30); printf("Unsubscribing...\n"); $Client->UnsubscribeAllMonitoredItems; printf("Waiting for 5 seconds...\n"); $startTime = time(); do { com_message_pump(1000); } while (time() < $startTime + 5); // Example output (truncated): //Subscribing... //Processing event notifications for 30 seconds... //[] Success //[] Success; Refresh; RefreshInitiated //[] Success; Refresh; (10 field results) [EastTank] 100! "The dialog was activated" @9/10/2019 8:08:23 PM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:13 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm was acknoweledged." @11/9/2019 9:56:23 AM //[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:17 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:09:07 PM //[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:10:09 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:02 PM //[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:16 PM //[] Success; Refresh; (10 field results) [NorthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:11 PM //[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:10:19 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:12 PM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:04 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:08:58 PM //[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:09:48 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM //[] Success; Refresh; (10 field results) [SouthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM //[] Success; Refresh; (10 field results) [SouthMotor] 700! "The alarm was acknoweledged." @10/14/2019 4:00:21 PM //[] Success; Refresh; (10 field results) [SouthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:03 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:02 PM //[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:59 PM //[] Success; Refresh; RefreshComplete //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:43 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:44 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:45 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:46 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:47 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:48 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:49 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:50 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:51 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:52 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [NorthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:53 AM //[] Success; (10 field results) [WestTank] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [SouthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:54 AM //[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:55 AM //...
// This example shows how to subscribe to event notifications, pull events, and display each incoming event. class procedure PullEventNotification.Main; var Client: EasyUAClient; EndTick: Cardinal; EventArgs: _EasyUAEventNotificationEventArgs; begin // Instantiate the client object and hook events Client := CoEasyUAClient.Create; // In order to use event pull, you must set a non-zero queue capacity upfront. Client.PullEventNotificationQueueCapacity := 1000; WriteLn('Subscribing...'); Client.SubscribeEvent( 'opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer', 'nsu=http://opcfoundation.org/UA/;i=2253', // UAObjectIds.Server 1000); WriteLn('Processing event notifications for 30 seconds...'); EndTick := GetTickCount + 60*1000; while GetTickCount < EndTick do begin EventArgs := Client.PullEventNotification(2*1000); if EventArgs <> nil then // Handle the notification event WriteLn(EventArgs.ToString); end; WriteLn('Unsubscribing...'); Client.UnsubscribeAllMonitoredItems; WriteLn('Finished.'); end;
Rem This example shows how to subscribe to event notifications, pull events, and display each incoming event. Option Explicit Const UAObjectIds_Server = "nsu=http://opcfoundation.org/UA/;i=2253" ' Instantiate the client object and hook events Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient") ' In order to use event pull, you must set a non-zero queue capacity upfront. Client.PullEventNotificationQueueCapacity = 1000 WScript.Echo "Subscribing..." Client.SubscribeEvent "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer", UAObjectIds_Server, 1000 WScript.Echo "Processing event notifications for 30 seconds..." Dim endTime: endTime = Now() + 30*(1/24/60/60) Do Dim EventArgs: Set EventArgs = Client.PullEventNotification(2*1000) If Not (EventArgs Is Nothing) Then ' Handle the notification event WScript.Echo EventArgs End If Loop While Now() < endTime ' Example output (truncated): 'Subscribing... 'Processing event notifications for 30 seconds... '[] Success '[] Success; Refresh; RefreshInitiated '[] Success; Refresh; (10 field results) [EastTank] 100! "The dialog was activated" @9/10/2019 8:08:23 PM '[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:13 PM '[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm was acknoweledged." @11/9/2019 9:56:23 AM '[] Success; Refresh; (10 field results) [EastTank] 500! "The alarm was acknoweledged." @10/14/2019 4:00:17 PM '[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:09:07 PM '[] Success; Refresh; (10 field results) [EastTank] 100! "The alarm severity has increased." @9/10/2019 8:10:09 PM '[] Success; Refresh; (10 field results) [NorthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM '[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:02 PM '[] Success; Refresh; (10 field results) [NorthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:16 PM '[] Success; Refresh; (10 field results) [NorthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM '[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:11 PM '[] Success; Refresh; (10 field results) [NorthMotor] 100! "The alarm severity has increased." @9/10/2019 8:10:19 PM '[] Success; Refresh; (10 field results) [WestTank] 100! "The dialog was activated" @9/10/2019 8:08:25 PM '[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:12 PM '[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM '[] Success; Refresh; (10 field results) [WestTank] 300! "The alarm was acknoweledged." @10/14/2019 4:00:04 PM '[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:08:58 PM '[] Success; Refresh; (10 field results) [WestTank] 100! "The alarm severity has increased." @9/10/2019 8:09:48 PM '[] Success; Refresh; (10 field results) [SouthMotor] 100! "The dialog was activated" @9/10/2019 8:08:25 PM '[] Success; Refresh; (10 field results) [SouthMotor] 300! "The alarm severity has increased." @11/9/2019 10:29:42 AM '[] Success; Refresh; (10 field results) [SouthMotor] 700! "The alarm was acknoweledged." @10/14/2019 4:00:21 PM '[] Success; Refresh; (10 field results) [SouthMotor] 500! "The alarm was acknoweledged." @10/14/2019 4:00:03 PM '[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:02 PM '[] Success; Refresh; (10 field results) [SouthMotor] 100! "The alarm severity has increased." @9/10/2019 8:09:59 PM '[] Success; Refresh; RefreshComplete '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:43 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:43 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:44 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:44 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:45 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:45 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:46 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:46 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:47 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:47 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:48 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:48 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:49 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:49 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:50 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:50 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:51 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:51 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:52 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:52 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:53 AM '[] Success; (10 field results) [NorthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:53 AM '[] Success; (10 field results) [WestTank] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM '[] Success; (10 field results) [SouthMotor] 500! "The alarm severity has increased." @11/9/2019 10:29:53 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:54 AM '[] Success; (10 field results) [Internal] 500! "Events Raised" @11/9/2019 10:29:54 AM '[] Success; (10 field results) [Internal] 500! "Raising Events" @11/9/2019 10:29:55 AM '...
Copyright © 2004-2023 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Send Documentation Feedback. Resources: Knowledge Base. Technical support: Online Forums, FAQ.